const seq = require('sequelize')
const time = require('../time')

module.exports = {
  NAME: 'chat_private_message',
  TABLE: {
    from: {
      type: seq.INTEGER(11),
      comment: '发送用户的 id',
      field: 'from',
      required: true,
    },
    to: {
      type: seq.INTEGER(11),
      comment: '接收用户的 id',
      field: 'to',
      required: true,
    },
    chat_id: {
      type: seq.STRING(64),
      comment: 'from 和 to 组成的字符串',
      field: 'chat_id',
      required: true,
    },
    content: {
      type: seq.TEXT,
      comment: '内容',
      field: 'content', //  相应的字段名称
    },
    read: {
      type: seq.INTEGER(1),
      defaultValue: 0,
      comment: '标识是否已读',
      field: 'read'
    },
    msg_type: {
      type: seq.INTEGER(1),
      defaultValue: 0,
      comment: '消息类型(文字/图片/文件/音乐等)',
      field: 'chat_type'
    },
    ...time.create_date,
    ...time.delete_date,
    ...time.delete_by,
  },
}
